import request from '@/service/request'
import { LoginParam, LoginResponse, MobileLoginParam } from './type/user.type'

/**
 * 帐号登录
 * @param {String} account - 用户名
 * @param {String} password - 密码
 * @returns Promise
 */
export const userAccountLogin = (parmas: LoginParam) => {
  return request<any, LoginResponse>('/login', 'post', parmas)
}

/**
 * 短信登录
 * @param {String} mobile - 手机号
 * @param {String} code - 验证码
 * @returns Promise
 */
export const userMobileLogin = (params: MobileLoginParam) => {
  return request<any, any>('/login/code', 'post', params)
}

/**
 * 获取短信登录验证码
 * @param {String} mobile - 手机号
 * @returns Promise
 */
export const userMobileLoginMsg = (mobile: string) => {
  return request('/login/code', 'get', { mobile })
}
